<template>
	<view class="news_detail">
		<text class="title">{{detail.title}}</text>
		<view class="info">
			<text>发表时间：{{detail.add_time|formatDate}}</text>
			<text>浏览:{{detail.click}}</text>
		</view>
		<view class="content">
			<rich-text :nodes="detail.content"></rich-text>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				id:0,
				detail:{}
			}
		},
		onLoad(options){
			this.id = options.id;
			this.getNewsData();
		},
		methods:{
			async getNewsData(){
				const res  = await this.$myRequest({
					url:"/api/getnew/"+this.id
				})
				this.detail = res.data.message[0];
				console.log(this.detail)
			}
		}
	}
</script>

<style>
	.news_detail{
		font-size:30rpx;
		padding:0 20rpx;
	}
	.news_detail .title{
		display:block;
		width:710rpx;
		text-align:center;
		margin:20rpx 0 ;
		font-weight:bold;
	}
	.news_detail .info{
		display:flex;
		justify-content:space-between;
		font-size:20rpx;
		padding:20rpx 0;
	}
	.news_detail .content{
		font-size:28rpx;
		color:#333;
	}
</style>